Understanding and Using C Pointers

I started developing an implementation of BK Trees in C recently. I had, many a time, played around with C but never done anything substantially big that would be deployed in some server. Now the time had come as the Python implementation was just too slow. So I picked up the good old K&R and revised the bits that was rusting in the corners of my brain. Now I also picked up 21st Century C. It was probably the right way to go and in a few weeks I had picked up almost all that I needed to work on the program.

Then I came across Understanding and Using C Pointers through the OReilly blogger program. Since I was working on C I decided to pick it up. The book is well written, short that you can complete it quickly. As the author rightly points out in the preface many C books offer a broad coverage of the language and they seem to address only the tip of the iceberg named pointers. They often give you just a brief chapter on Pointers. But the fact is, in C, pointers are the most important concept. If you get that right you will start writing efficient C programs.

The book starts with the basics of pointers to those who are not familiar with them. It moves on to explain dynamic memory management in C, using function pointers, pointer arithmetic and arrays, how to use structures and pointers. The good part of the book is at almost the end where the Author talks about common security issues and the improper uses of pointers. He talks a length about dangling pointers, accessing memory outside the bounds of an array.

One might ask is it necessary to have a book on Pointers? I would say a definite yes. Memory management is a must if you want to go past the examples given in most C text books. I do not see any other book just dealing with pointers. So if you want to improve your C skills this book is a good read.

Created on Jun 22 2013